package javase_class_250914;

/**
 * ClassName: OrderedPair
 * Package: javase_class_250914
 * Description:
 *
 * @Author harkjeans
 * @Create 2025/9/14 14:09
 * @Version 1.0
 */
public class OrderedPair<K, V> implements Pair<K, V> {
    private K key;
    private V value;

    public OrderedPair(K key, V value) {
        this.key = key;
        this.value = value;
    }

    public K getKey() { return key; }
    public V getValue() { return value; }

    public static void main(String[] args) {
        Pair<String, Integer> p1 = new OrderedPair<>("Age", 30);
        System.out.println(p1);
    }
}
interface Pair<K, V> { // 可以声明多个类型参数
    K getKey();
    V getValue();
}